﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Folder2
{
    
    public partial class Form1 : Form
    {
        private double TargetX;
        private double TargetY;
        
        public Form1()
        {
            InitializeComponent();
        }

  

        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            TargetX = e.X;
            TargetY = e.Y;
        }

        private void Form1_Click(object sender, EventArgs e)
        {
            
            double tx = 0;
            double ty = 0;
            while (true)
            {
                tx = TargetX - pictureBox1.Location.X;
                ty = TargetY - pictureBox1.Location.Y;
                pictureBox1.Location = new Point(Convert.ToInt16(pictureBox1.Location.X + (0.1 * tx)), Convert.ToInt16(pictureBox1.Location.Y + (0.1 * ty)));
                if (Math.Abs(tx) <= 5 && Math.Abs(ty) <= 5)
                    break;

            }


        }

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            TargetX = e.X;
            TargetX = e.Y;
        }

  
    }
}
